#pragma once
#include <boost/shared_array.hpp>
#include <boost/shared_ptr.hpp>
#include <iterator>
#include <vector>
#include "mytools.h"
#include <algorithm>
#include <comdef.h>
#include <mshtml.h>
#include <string>
#pragma warning(disable : 4146)	//see Q231931 for explaintation
#import <mshtml.tlb> no_auto_exclude

using namespace std;
using namespace boost;

typedef boost::shared_ptr<vector<char> >  BSP;
class Httpdownloader
{
public:
        Httpdownloader(void);
        bool OpenUrl(const wchar_t* url);
        BSP getcontext(bool isUtf8 = false);
        wstring QueryURLType(DWORD dwInfoLevel);
        BSP getHtml();
        ~Httpdownloader(void);
        static int inflate_read(void *source,int len,char **dest,int gzip,int &size);
private:
        void CloseInternetHandle();
private:
        wstring m_url;
        HINTERNET m_hinternet;
        HINTERNET m_hurl;
        
};

